<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <script src="__JS__/jquery-1.11.3.js"></script>
    <script src="__JS__/ajaxfileupload.js"></script>
    <script src="__JS__/jquery.validate.js"></script>
    <script src="__JS__/messages_zh.js"></script>
    <script src="__JS__/layer/layer.js"></script>
    <link rel="stylesheet" href="__CSS__/information.css">
</head>
<body>
<h2 class="information_b">管理员信息</h2><br><br>
<table class="information_bo" cellpadding="1" cellspacing="1"  rules="all" frame="box">
    <tr>
    <th width="20%">ID</th>
    <th width="30%">管理员</th>
    <th width="30%">管理密码</th>
    <th width="20%">操作</th>
    </tr>
    {volist name='aa' id='v'}
    <tr>
        <td>{$v.id}</td>
        <td>{$v.username}</td>
        <td>{$v.password}</td>

        <td>
            <a href="{:url('delete')}?id={$v.id}"><input type="submit" value="删除"></a>
            <button id="update">修改</button></td>
    </tr>
    {/volist}
</table>
<p>请填写修改内容：<input type="text" name="username" id="username"></p>
</body>
</html>
<script>
    var a="{:url('admin/controller/Index/update')}";
</script>
<script>

    $(function(){
        $("#update").click(function(){
            alert("456");
            $.ajax({
                type:"post",
                url:a,
                data:{
                    username:$("#username").val(),
                    usernames:this.id
                },
                success:function(msg){
                    if(msg=="1"){
                        alert("输入不能为空，请重新输入");
                        window.location.href="{:url('information')}";
                    }else{

                        window.location.href="{:url('information')}";
                    }
                },
                error: function () {
                    alert("服务器无反应，请重试！");
                }

            })
        })
    })
</script>